<template>
  <div>
    <el-button type="danger" @click="payOrder()">立即支付</el-button>
    <div class="payform" v-show="false"></div>
  </div>


</template>

<script>

import axios from "axios";
import request from "@/utils/request";

export default {
  name: "payOrder",

  methods: {
    payOrder(){
      const loading = this.$loading({
        lock: true,
        text: '正在跳转',
        spinner: 'el-icon-loading',
        background: 'rgba(255,255,255,0.73)'
      });
      if(true){
        // 支付宝支付
        request({
          url: 'http://localhost:9092/paymanagement/pay',
          method: 'get',
        }).then(res=>{
          document.querySelector('.payform').innerHTML = res
          this.$nextTick(() => {
            loading.close();
            document.forms[0].submit()
          })
        })
      }else {
        this.$message.warning("暂未开通微信支付")
      }
    }
  }
}
</script>

<style scoped>
.payBody{
  width: 90%;
  margin: 0 auto;
  background-color: white;
  border-radius: 10px;
  padding: 20px
}
.order{
  display: flex;
  justify-content: space-between;
}
.goodInfo{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.payType{
  margin-left: 40px;
}
.title-bottom{
  margin-bottom: 20px;
}
</style>

